﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;

public partial class Admin_login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void butLogin_Click(object sender, EventArgs e)
    {
        if (txtUsername.Text.Length == 0)
        {
            txtUsername.BackColor = Color.Red;
            txtUsername.Focus();
            }
        else if (txtPass.Text.Length == 0)
        {
            txtPass.BackColor = Color.Red;
            txtPass.Focus();
        }
        else
        {
            clsAcount clsAc = new clsAcount(txtUsername.Text, txtPass.Text);
            int n = clsAc.checkAcount();
            if (n == 0)
                lblThongbao.Text = "Đăng nhập thất bại!";
            else
            {
                Session["username"] = txtUsername.Text;
                Session["permission"] = n;
                Response.Redirect("default.aspx");
            }
        }
    }
}
